import Mock from 'mockjs'
export default{
    getMenu:config=>{
        const {username,password}=JSON.parse(config.body)
        //首先判断用户是否存在
        //判断账号密码是否正确
        if(username==='admin'&&password==='admin'){
            return {
                code:20000,
                data:{
                    menu:[
                        {
                            path:'/',
                            name:'home',
                            lable:'首页',
                            icon:'s-home',
                            url:'home/index'
                        },
                        {
                            path:'/mall',
                            name:'mall',
                            lable:'商品管理',
                            icon:'video-play',
                            url:'mall/index'
                        },
                        {
                            path:'/user',
                            name:'user',
                            lable:'用户管理',
                            icon:'user',
                            url:'user/index'
                        },
                        {
                            name:'其它',
                            icon:'location',
                            children:[
                                {
                                    path:'/page1',
                                    name:'page1',
                                    lable:'页面1',
                                    icon:'setting',
                                    url:'other/pageOne'
                                },
                                {
                                    path:'/page2',
                                    name:'page2',
                                    lable:'页面2',
                                    icon:'setting',
                                    url:'other/pageTwo'
                                }
                            ]
                        }
                    ],
                    token:Mock.Random.guid(),
                    message:'获取成功'
                }
            }
        }
        else if(username==='2263930159'&&password==='2263930159'){
              return {
                code:20000,
                data:{
                    menu:[
                        {
                            path:'',
                            name:'/home',
                            label:'首页',
                            icon:'s-home',
                            url:'home/index'
                        },
                        {
                            path:'/video',
                            name:'video',
                            label:'商品管理',
                            icon:'video-play',
                            url:'mall/index'
                        },
                    ],
                    token:Mock.Random.guid(),
                    message:'登录成功'
                }
              }
        }
        else{
            return {
                code:-999,
                data:{
                  message:'密码错误'
                }
            }
        }
    }
}